#include "includes.h"


void shooter_init()
{
	set_bit(DDRE,PE0);
	set_bit(PORTE,PE0);
	FIRE_init();
}

void FIRE_init()
{
        //setting PWM-Port as output. Timer/Counter3, Output C.
        DDRE |= (1 << PE5);

        // Fast PWM, Mode 14
        TCCR3A |= (1 << WGM31);
        TCCR3B |= (1 << WGM33)|(1 << WGM32);

        //non-inverting mode
        TCCR3A |= (1 << COM3C1);

        // Timers running at MCU/1024, roughly 15 kHz (using ATMEGA128)
        TCCR3B |= (1 << CS32)|(1 << CS30);

        OCR3C = 2000;
        ICR3 = 2000;
}


void shoot(uint8_t button)
{
	if(button==1)
	{
		OCR3C = 1000;
	}
	else
	{
		OCR3C =2000;
	}
}

